package com.alpha.core.utils;

/**
 * 断言某些对象或值是否符合规定，否则抛出异常。经常用于做变量检查
 *
 * @author chenruwan
 * @since 2022-01-01
 */
public class Assert {
    /**
     * @see cn.hutool.core.lang.Assert#isTrue(boolean, String, Object...)
     */
    public static void isTrue(boolean expression, String format, Object... params) throws IllegalArgumentException {
        cn.hutool.core.lang.Assert.isTrue(expression, format, params);
    }

    /**
     * @see cn.hutool.core.lang.Assert#notNull(Object, String, Object...)
     */
    public static <T> T notNull(T object, String format, Object... params) throws IllegalArgumentException {
        return cn.hutool.core.lang.Assert.notNull(object, format, params);
    }

    /**
     * @see cn.hutool.core.lang.Assert#notEmpty(CharSequence, String, Object...)
     */
    public static <T extends CharSequence> T notEmpty(T text, String format, Object... params)
            throws IllegalArgumentException {

        return cn.hutool.core.lang.Assert.notEmpty(text, format, params);
    }

    /**
     * @see cn.hutool.core.lang.Assert#notEmpty(Iterable, String, Object...)
     */
    public static <E, T extends Iterable<E>> T notEmpty(T collection, String format, Object... params)
            throws IllegalArgumentException {

        return cn.hutool.core.lang.Assert.notEmpty(collection, format, params);
    }

    /**
     * Utility classes should not have public constructors
     */
    private Assert() {
    }
}
